package org.cbg.btn;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;

import javax.swing.SwingConstants;

import com.tool.btn.FaHuoBtn;
import come.tool.JDialog.TiShiUtil;
import org.cbg.panel.TraslationWantSentYijishangpinJpanel;
import org.cbg.panel.TraslationWantSentYijishangpinModelJpanel;
import org.come.Frame.OptionsJframe;
import org.come.Frame.ZhuFrame;

import com.tool.btn.MoBanBtn;
import org.come.until.FormsManagement;

public class CBGMySaleBtn extends MoBanBtn {

    private int leixing;
    private TraslationWantSentYijishangpinJpanel jpanel1;
    private TraslationWantSentYijishangpinModelJpanel jpanel2;

    public CBGMySaleBtn(String iconpath, int type, int leixing, TraslationWantSentYijishangpinJpanel jpanel) {
        super(iconpath, type);
        // TODO Auto-generated constructor stub
        this.leixing = leixing;
        this.jpanel1 = jpanel;
    }


    public CBGMySaleBtn(String iconpath, int type, Color[] colors, Font font, int leixing, String text,
            TraslationWantSentYijishangpinJpanel jpanel) {
        super(iconpath, type, colors);
        // TODO Auto-generated constructor stub
        this.leixing = leixing;
        this.jpanel1 = jpanel;
        setText(text);
        setFont(font);
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.CENTER);
    }


    public CBGMySaleBtn(String iconpath, int type, Color[] colors, Font font, int leixing, String text,
            TraslationWantSentYijishangpinModelJpanel jpanel) {
        super(iconpath, type, colors);
        // TODO Auto-generated constructor stub
        this.leixing = leixing;
        this.jpanel2 = jpanel;
        setText(text);
        setFont(font);
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.CENTER);
    }


    @Override
    public void chooseyes() {
        // TODO Auto-generated method stub

    }

    @Override
    public void chooseno() {
        // TODO Auto-generated method stub

    }

    @Override
    public void nochoose(MouseEvent e) {
        if (leixing == 0) {// 下拉
            jpanel1.xl();
        } else if (leixing >= 1 && leixing <= 4) {// 首页末页←→
            String value = jpanel1.YSqh(leixing);
            if (value != null) {
                ZhuFrame.getZhuJpanel().addPrompt2(value);
            }
        } else if (leixing == 5) {// 5上架6下架7取回
            jpanel2.caozuo(getName());
        } else if (leixing == 6) {// 发货
            FaHuoBtn.jpanel2 = jpanel2;
            FormsManagement.showForm(559);
        } else if(leixing == 7){ // 确认收款
            OptionsJframe.getOptionsJframe().getOptionsJpanel().showBox(TiShiUtil.CBGFahuo, jpanel2, String.format("#R注意：#Y您确定收到了#R %s #Y的货款了吗？确认后买家将收到获取，请您确认收到款后再点确定！",jpanel2.salegoods.getSalename()));

        }else if(leixing == 8){
            jpanel2.caozuo("取回");
        }
    }
}
